package com.lds.config.center.remote.client.autoconfigure;


import com.lds.config.center.remote.client.properties.ConfigCenterRemoteClientProperties;
import com.lds.config.center.remote.client.server.AppRemoteClient;
import com.lds.config.center.remote.client.server.ClusterRemoteClient;
import com.lds.config.center.remote.client.server.EnvRemoteClient;
import com.lds.config.center.remote.client.server.ItemRemoteClient;
import com.lds.config.center.remote.client.server.NamespaceRemoteClient;
import com.lds.config.center.remote.client.server.impl.AppRemoteClientImpl;
import com.lds.config.center.remote.client.server.impl.ClusterRemoteClientImpl;
import com.lds.config.center.remote.client.server.impl.EnvRemoteClientImpl;
import com.lds.config.center.remote.client.server.impl.ItemRemoteClientImpl;
import com.lds.config.center.remote.client.server.impl.NamespaceRemoteClientImpl;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(ConfigCenterRemoteClientProperties.class)
public class ConfigCenterRemoteClientAutoConfiguration {
    
    private final ConfigCenterRemoteClientProperties properties;
    
    public ConfigCenterRemoteClientAutoConfiguration(ConfigCenterRemoteClientProperties properties) {
        this.properties = properties;
    }
    
    @Bean
    public EnvRemoteClient envRemoteClient() {
        return new EnvRemoteClientImpl(properties);
    }
    
    @Bean
    public ClusterRemoteClient clusterRemoteClient() {
        return new ClusterRemoteClientImpl(properties);
    }
    
    @Bean
    public AppRemoteClient appRemoteClient() {
        return new AppRemoteClientImpl(properties);
    }
    
    @Bean
    public NamespaceRemoteClient namespaceRemoteClient() {
        return new NamespaceRemoteClientImpl(properties);
    }
    
    @Bean
    public ItemRemoteClient itemRemoteClient() {
        return new ItemRemoteClientImpl(properties);
    }
    
}
